package com.kaishengit.service;

import org.springframework.transaction.annotation.Transactional;

import com.kaishengit.dao.CompanyDao;
import com.kaishengit.pojo.Company;
import com.kaishengit.pojo.User;
import com.kaishengit.util.DateUtil;

@Transactional
public class CompanyService {
	private CompanyDao companyDao;
	
	public void save(Company company, String view, String grouptype, User user) {
		if("grouptype".equals(view)) {
			view = grouptype;
		}
		company.setUser(user);
		company.setView(view);
		company.setCreatetime(DateUtil.getNow());
		
		companyDao.save(company);
	}

	public CompanyDao getCompanyDao() {
		return companyDao;
	}

	public void setCompanyDao(CompanyDao companyDao) {
		this.companyDao = companyDao;
	}

	public Company findById(String id) {
		return companyDao.get(id);
	}

	
	
}
